package lib.gui;

import java.io.File;

import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;

import lib.Base.Post;
import lib.Common.Cast;
import lib.Common.Path;

import org.swixml.SwingEngine;

public class GuiProfilePost {
	/**
	 * Class which represents a post entry
	 */
	private JTextArea post;
	private JLabel date;

	public GuiProfilePost(Post post) {

		try {
			new SwingEngine(this).render(new File(Path.GUI_PATH
					+ "gui-profile-post.xml")).setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		this.post.setText(post.getText());
		this.date.setText(Cast
				.formatTimeStampAs_ddmmyyyy(post.getTime()));
	}
	
	public JComponent getPanel(){
		return (JPanel)post.getParent();
	}
}